﻿<%@ Page Language="C#" MasterPageFile="~/cms.master" AutoEventWireup="true" ValidateRequest="false"
    CodeFile="LanguageEdit.aspx.cs" Inherits="LanguageEdit" Title="<%$Resources:Language,CmsLanguageEdit %>"
    MaintainScrollPositionOnPostback="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="axc" %>
<%@ Register Src="../controls/ctrlShowInfo.ascx" TagName="ctrlShowInfo" TagPrefix="uc1" %>
<%@ Register Src="~/controls/ctrlWait.ascx" TagName="ctrlWait" TagPrefix="ctrl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">
    <h2>
        <%= Resources.Language.LanguagesSettings%></h2>
    <ctrl:ctrlWait ID="ctrlWait" runat="server" />
    <uc1:ctrlShowInfo ID="CtrlShowInfo" runat="server" />
    <axc:TabContainer ID="tcLanguageEdit" runat="server" ActiveTabIndex="0" EnableTheming="True"
        Font-Size="71%">
        <axc:TabPanel ID="tpPageSettings" runat="server" HeaderText="<%$Resources:Language,LanguagesSettings %>">
            <ContentTemplate>
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <div class="vSeparate">
                            <%= Resources.Language.DefaulCountry %>:
                            <asp:DropDownList ID="ddlDefaultCountry" runat="server" DataTextField="Name" DataValueField="IDCountry" CssClass="DropDown">
                            </asp:DropDownList>
                            <asp:Button ID="btnSaveCountry" runat="server" Text="<%$Resources:Language, Save %>"
                                OnClick="btnSaveCountry_Click" />
                        </div>
                        <div class="vSeparate">
                            <asp:Repeater ID="rptLanguages" runat="server">
                                <HeaderTemplate>
                                    <table class="cmsTables">
                                        <tr>
                                            <th>
                                                ID
                                            </th>
                                            <th>
                                                <%=Resources.Language.Name%>
                                            </th>
                                            <th>
                                                <%=Resources.Language.Culture%>
                                            </th>
                                            <th>
                                                <%=Resources.Language.ActiveM%>
                                            </th>
                                            <th>
                                                <%=Resources.Language.FlagUrl%>
                                            </th>
                                            <th>
                                                <%=Resources.Language.Default%>
                                            </th>
                                            <th>
                                            </th>
                                        </tr>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr>
                                        <td>
                                            <%#Eval("LanguageID")%>
                                        </td>
                                        <td>
                                            <%#Eval("Name")%>
                                        </td>
                                        <td>
                                            <%#Eval("Culture")%>
                                        </td>
                                        <td>
                                            <%# Convert.ToBoolean(Eval("Active")) == true?Resources.Language.Yes:Resources.Language.No%>
                                        </td>
                                        <td>
                                            <img alt="" src='<%# "../" + ((ShopModel.Language)Container.DataItem).FlagUrl %>' />
                                            <%#Eval("FlagUrl")%>
                                        </td>
                                        <td>
                                            <%#Convert.ToBoolean(Eval("IsDefault")) == true ? Resources.Language.Yes : Resources.Language.No%>
                                        </td>
                                        <td>
                                            <asp:LinkButton ID="lbDeleteLanguage" runat="server" CommandName="DeleteL" CommandArgument='<%#Eval("LanguageID")%>'
                                                OnCommand="LanguagesCommand"><%=Resources.Language.DeleteUpper %></asp:LinkButton>|<asp:LinkButton
                                                    ID="lbEditLanguage" runat="server" CommandName="EditL" CommandArgument='<%#Eval("LanguageID")%>'
                                                    OnCommand="LanguagesCommand"><%=Resources.Language.Edit %></asp:LinkButton><br />
                                            <asp:LinkButton ID="lbSetDefaultLanguage" runat="server" CommandName="SetDefaultL"
                                                CommandArgument='<%#Eval("LanguageID")%>' OnCommand="LanguagesCommand"><%=Resources.Language.SetAsDefault %></asp:LinkButton>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <asp:TextBox ID="LangNameTB" runat="server" />
                                </td>
                                <td>
                                    <asp:TextBox ID="LangCultureTB" runat="server" />
                                </td>
                                <td>
                                    <asp:CheckBox ID="LangActiveCB" runat="server" />
                                </td>
                                <td>
                                    <asp:TextBox ID="LangFlagUrlTB" runat="server" />
                                </td>
                                <td>
                                    <asp:CheckBox ID="LangIsDefaultCB" runat="server" Enabled="false" />
                                </td>
                                <td>
                                    <asp:Button ID="LangAddBTN" runat="server" Text="<%$Resources:Language,Add %>" OnCommand="LanguagesCommand"
                                        CommandName="AddL" />
                                    <asp:Button ID="LangCancelBTN" runat="server" Text="<%$Resources:Language,Cancel %>"
                                        OnCommand="LanguagesCommand" CommandName="CancelL" />
                                </td>
                            </tr>
                            </table>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </ContentTemplate>
        </axc:TabPanel>
        <axc:TabPanel ID="tpTextResourcesEdit" runat="server" HeaderText="<%$Resources:Language,TextEdit %>">
            <ContentTemplate>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div class="vSeparate">
                            <asp:DropDownList ID="ddlLanguage" runat="server" DataTextField="Name" DataValueField="Culture"
                                AutoPostBack="true" OnSelectedIndexChanged="ddlLanguage_SelectedIndexChanged">
                            </asp:DropDownList>
                            <asp:Button ID="btnSave" runat="server" Text='<%$ Resources:Language,Save %>' OnClick="btnSave_Click" />
                            <asp:Button ID="btnCancel" runat="server" Text='<%$ Resources:Language,Cancel %>'
                                OnClick="btnCancel_Click" />
                        </div>
                        <div class="vSeparate">
                            <asp:GridView ID="gvResources" runat="server" CssClass="cmsTables" AutoGenerateColumns="false"
                                OnRowEditing="gvResources_RowEditing" OnRowCancelingEdit="gvResources_CancelingEdit"
                                OnRowUpdating="gvResources_RowUpdating">
                                <Columns>
                                    <asp:BoundField DataField="Key" HeaderText='<%$ Resources:Language,Key %>' ReadOnly="true"
                                        ItemStyle-Width="15%" HeaderStyle-Width="15" />
                                    <asp:BoundField DataField="Default" HeaderText='<%$ Resources:Language,DefaultLanguage %>'
                                        ControlStyle-Width="100%" ItemStyle-Width="40%" HeaderStyle-Width="40%" />
                                    <asp:BoundField DataField="Selected" HeaderText='<%$ Resources:Language,SelectedLanguage %>'
                                        ControlStyle-Width="100%" ItemStyle-Width="40%" HeaderStyle-Width="40%" />
                                    <asp:CommandField ShowEditButton="true" ItemStyle-Width="5%" HeaderStyle-Width="5%" />
                                </Columns>
                            </asp:GridView>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </ContentTemplate>
        </axc:TabPanel>
    </axc:TabContainer>
</asp:Content>
